﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using SharedResources.ViewModel;
using VisualisationModule.View;

//Written by Luke Bermingham
//6/05/12 The viewmodel for the SetSmoothnessPopUp

namespace VisualisationModule.ViewModel
{
    class SmoothDatasetViewModel: BaseViewModel
    {

        public void ShowSmoothDataSetPopUp()
        {
            new SmoothDatasetPopUp().Show();
        }

        //Command to make the begin smoothing button clickable in the correct context
        private RelayCommand _beginSmoothingCommand;
        public ICommand BeginSmoothingCommand
        {
            get
            {
                return _beginSmoothingCommand = MakeCommandSafely(_beginSmoothingCommand, () => BeginSmoothing(), () => CanBeginSmoothing());
            }
        }

        private string _degreesTolerance = "";
        public string DegreesTolerance
        {
            get
            {
                if(_degreesTolerance == "")
                {
                    _degreesTolerance = "30";
                }
                return _degreesTolerance;
            }
            set
            {
                _degreesTolerance = value;
                OnPropertyChanged("DegreesTolerance");
            }
        }

        private bool CanBeginSmoothing()
        {
            int parsedValue;
            if (Int32.TryParse(DegreesTolerance, out parsedValue))
            {
                if(parsedValue < 360 && parsedValue > 0)
                {
                    return true;
                }
            }
            return false;
        }

        private void BeginSmoothing()
        {
            
        }

    }
}
